package com.weiyi.portal.controller;

import com.weiyi.common.common.api.CommonResult;
import com.weiyi.portal.dto.AdvertiseNewsDTO;
import com.weiyi.portal.modules.pms.service.PmsProductCategoryService;
import com.weiyi.portal.modules.pms.service.PmsProductService;
import com.weiyi.portal.modules.sms.service.SmsAdvertiseNewsRelationService;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping("/advertise")
public class AdvertiseController {
    @Autowired
    SmsAdvertiseNewsRelationService advertiseNewsRelationService;
    @Autowired
    PmsProductService productService;
    @Autowired
    PmsProductCategoryService productCategoryService;

    @RequestMapping(value = "/getNews",method = RequestMethod.GET)
    public CommonResult getNews(@RequestBody Long aid){
        List<AdvertiseNewsDTO> news = advertiseNewsRelationService.getNewsByAid(aid);
        return CommonResult.success(news);
    }
}
